<template>
	<view class="wxnumber">
		<view class="title">
			添加支付宝账号
		</view>
		<view class="sm">
			请绑定本人支付宝账户
		</view>
		<view class="inputBox">
			<view class="lable">
				真实姓名
			</view>
			<input class="inputitem" type="text" v-model="alipay_name" placeholder="请输入真实姓名" />
			<view class="lable" style="margin-top: 10rpx;">
				手机号
			</view>
			<input class="inputitem" type="text" v-model="alipay_account" placeholder="请输入手机号" />
		</view>
		<!-- 	<view class="uptext">
			上传收款码
		</view>
		<image src="../../static/image/share.png" mode=""
			style="width: 202rpx;height: 202rpx;margin-top: 20rpx;margin-left: 30rpx;"></image> -->

		<view class="btn" @click="handleSava">
			提交
		</view>

	</view>
</template>

<script>
	import {
		checkuser
	} from "@/api/api.js"
	export default {
		data() {
			return {
				alipay_name: "",
				alipay_account: "",
			}
		},
		onLoad() {
			if (!uni.getStorageSync("token")) {
				uni.reLaunch({
					url: "../login/index"
				})
				return
			}
		},
		methods: {
			async handleSava() {
				if (this.alipay_name == "") {
					uni.showToast({
						title: "请填写支付宝真实姓名",
						icon: "none",
						duration: 1500
					});
					return
				}
				if (this.alipay_account == "") {
					uni.showToast({
						title: "请填写支付宝账号",
						icon: "none",
						duration: 1500
					});
					return
				}

				let data = {
					alipay_name: this.alipay_name,
					alipay_account: this.alipay_account
				}
				let res = await checkuser(data)
				if (res.code == 1000) {
					uni.showToast({
						title: "支付宝账号修改成功",
						icon: "none",
						duration: 1500
					});
					setTimeout(() => {
						uni.navigateBack({
							delta: 1
						})
					}, 2000)
				} else {
					uni.showToast({
						title: res.message,
						icon: "none",
						duration: 1500
					});
				}

			},
		}
	}
</script>

<style scoped lang="scss">
	.wxnumber {
		.title {
			font-size: 28rpx;
			font-family: PingFang SC-Medium, PingFang SC;
			font-weight: 400;
			color: #333333;
			line-height: 28rpx;
			margin-left: 30rpx;
			margin-top: 20rpx;
		}

		.sm {
			font-size: 28rpx;
			font-family: PingFang SC-Regular, PingFang SC;
			font-weight: 400;
			color: #707070;
			line-height: 28rpx;
			margin-left: 30rpx;
			margin-top: 10rpx;
		}

		.inputBox {
			width: 100%;
			height: 296rpx;
			background: #FFFFFF;
			padding: 20rpx 30rpx;
			box-sizing: border-box;
			margin-top: 10rpx;

			.lable {
				font-size: 30rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 400;
				color: #333333;
				line-height: 42rpx;
			}

			.inputitem {
				width: 690rpx;
				height: 76rpx;
				background: #F1F1F1;
				text-indent: 20rpx;
				margin-top: 10rpx;
			}
		}

		.uptext {
			font-size: 30rpx;
			font-family: PingFang SC-Medium, PingFang SC;
			font-weight: 400;
			color: #333333;
			line-height: 42rpx;
			margin-top: 18rpx;
			margin-left: 30rpx;
		}

		.btn {
			width: 542rpx;
			height: 80rpx;
			background: #04767C;
			border-radius: 512rpx 512rpx 512rpx 512rpx;
			font-size: 36rpx;
			font-family: PingFang SC-Bold, PingFang SC;
			font-weight: 400;
			color: #FFFFFF;
			line-height: 80rpx;
			text-align: center;
			margin: 0 auto;
			margin-top: 142rpx;
		}
	}
</style>